#include<iostream>
#include<vector>
using namespace std;

int main()
{
    int n = 0, k = 0;
    long long ans = 0;
    cin >> n >> k;
    int t = k;
    vector<int> arr(n);
    for (int i = 0; i < n; i++) cin >> arr[i];
    for (int i = 0; i < n; i++)
    {
        if (arr[i] <= t)
        {
            t -= arr[i];
            ans++;
        }
        else
        {
            ans += i * 2 + 1;
            t = k - arr[i];
        }
    }
    cout << ans << endl;
    return 0;
}